package com.zb.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.zb.entity.ZjStoreInboundMaterial;
import com.zb.entity.ZjStoreOutboundMaterial;
import com.zb.extend.StoreInboundMaterialExtend;

import java.util.List;

/**
 * <p>
 * 入库物料表 服务类
 * </p>
 *
 * @author WEN
 * @since 2024-01-12
 */
public interface ZjStoreInboundMaterialService extends IService<ZjStoreInboundMaterial> {

    /**
     * 根据入库单ID查询入库物料
     * @param storeInboundId 入库单ID
     * @return
     */
    List<ZjStoreInboundMaterial> getbyStoreInboundId(Long storeInboundId);

    /**
     * 根据入库ID查询
     * @param storeInboundIds
     * @return
     */
    List<StoreInboundMaterialExtend> getbyStoreInboundIds(List<Long> storeInboundIds);

    /**
     * 根据入库ID获取入库物料 & 即时库存
     * @param storeInboundId 入库物料ID
     * @return
     */
    List<StoreInboundMaterialExtend> getMaterialsStockbyStoreInboundId(Long storeInboundId);

    /**
     * 根据仓位ID集合分组统计预入库数量
     * @param storePositionIds 仓位ID
     * @return
     */
    List<ZjStoreInboundMaterial> getInStoreQtyGroupByStorePositionIds(List<Long> storePositionIds);

    /**
     * 根据商品ID分组统计预入库数量
     * @param storeId 仓库ID
     * @param storePositionId 仓位ID
     * @param goodsIds 商品ID
     * @param goodsSpecIds 商品规格ID
     * @return
     */
    List<ZjStoreInboundMaterial> getInStoreQtyByStoreIdOrStorePositionIdAndGroupByGoodsId(Long storeId, Long storePositionId, List<Long> goodsIds, List<Long> goodsSpecIds);

    /**
     * 根据仓库ID分组统计预入库数量
     * @param storeIds 仓库ID
     * @param goodsIds 商品ID
     * @param goodsSpecIds 商品规格ID
     * @return
     */
    List<ZjStoreInboundMaterial> getInStoreQtyByStoreIdGroupByStoreId(List<Long> storeIds, List<Long> goodsIds, List<Long> goodsSpecIds);

    /**
     * 根据入库ID更新入库物料状态
     * @param storeInboundId 入库单ID
     * @param status 入库状态：1-待审核，2-已审核，3-作废/驳回
     */
    void updateStatusById(Long storeInboundId, Integer status);

    /**
     * 根据删除的仓库仓位ID获取关联入库的仓位ID
     * @param delStorePositionIds 删除的仓库仓位ID
     * @return
     */
    List<Long> getStorePositionIdsByDelStorePositionIds(List<Long> delStorePositionIds);

    /**
     * 根据仓库ID获取关联入库物料的仓库ID
     * @param storeIds 仓库ID
     * @return
     */
    List<Long> getByStoreIds(List<Long> storeIds);
}
